// 跳跃游戏  覆盖范围越来越多 最后看是否能覆盖到最后

/**
 * @param {number[]} nums
 * @return {boolean}
 */
var canJump = function (nums) {
  let cover = 0
  for (let i = 0; i <= cover; i++) {
    cover = Math.max(cover, i + nums[i])
    console.log(cover);

    if (cover >= nums.length - 1) return true
  }
  return false
};

console.log(canJump([3, 2, 1, 0, 4]))